/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.gob.fonafe.dao.impl.stored;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import javax.sql.DataSource;
import oracle.jdbc.OracleTypes;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.jdbc.core.SqlOutParameter;
import org.springframework.jdbc.object.StoredProcedure;
import pe.gob.fonafe.domain.TipoInmuebleBean;
/**
 *
 * @author Irving
 */
public class ListarTipoInmuebleSP extends StoredProcedure{
    private static final String PROC_PARAM ="USERGLC.P_LISTAR_TIPO_INMUEBLE";
              
    public ListarTipoInmuebleSP(DataSource ds) {
        super(ds,PROC_PARAM);
        declareParameter(new SqlOutParameter("cCursor", OracleTypes.CURSOR,new ListarTipoInmRowMapper()));
        compile();
    }
    
    public Map execute() {
        Map inputs = new HashMap();
        return super.execute(inputs);
    }
    
    private static class ListarTipoInmRowMapper implements RowMapper<TipoInmuebleBean>{
   
        public TipoInmuebleBean mapRow(ResultSet rs, int rowNum) throws SQLException {
            TipoInmuebleBean bean = new TipoInmuebleBean();
            bean.setIdTipoInmueble(rs.getInt("IDTIPOINMUEBLE"));
            bean.setNombre(rs.getString("NOMBRE"));
            return bean;
        }
    }
}
